﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Customer_Profile.Admin
{
    public partial class UsergroupModify : System.Web.UI.Page
    {
        protected static string groupid;
        protected void Page_Load(object sender, EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                    groupid = Request.QueryString["id"].ToString();
                DataSet ds = GroupDao.getGroup(groupid);
                txtUserGroupId.Value = ds.Tables[0].Rows[0]["group_id"].ToString();
                txtUserGroupName.Value = ds.Tables[0].Rows[0]["group_name"].ToString();
                txtDesc.Value = ds.Tables[0].Rows[0]["group_remark"].ToString();
            }
        }

        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            string groupname = txtUserGroupName.Value;
            string mark = txtDesc.Value;
            if (GroupDao.ModifyGroup(groupid, groupname, mark) == true)
            {
                Response.Write("<script language=javascript>alert('Succeed!');</script>");
                //记录用户操作日志
                //CVOC.Comm.WriteSystemLog(Session["SS_USER_ID"].ToString(), Utility.ReplaceChar(Utility.ReplaceQuote(Request["menu_idx"].ToString()), true), "03", Page.Request.UserHostAddress, Page.Request.Path, "修改用户组操作，用户组ID：" + txtUserGroupId.Value);
                Response.Redirect("UserGroupManage.aspx", true);
            }
        }

        protected void btnBack_ServerClick(object sender, EventArgs e)
        {
            Response.Redirect("UserGroupManage.aspx", true);
        }
    }
}
